/**
 * 角色接口
 */

import { Get, Post, Delete, Put, RequestParams, ResponseData } from '../../common/decorator'

export default class RoleService {
  // 查询角色列表
  @Get("/system/role/list", { requestType: 'params' })
  listRole(res: object) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }
  
  // 查询角色详细
  @Get("/system/role/${roleId}", { requestType: 'path' })
  getRole(res: { roleId: any }) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 新增角色
  @Post("/system/role", { requestType: 'data' })
  addRole(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 修改角色
  @Put("/system/role", { requestType: 'data' })
  updateRole(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 角色数据权限
  @Put("/system/role/dataScope", { requestType: 'data' })
  dataScope(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 角色状态修改
  @Put("/system/role/dataScope", { requestType: 'data' })
  changeRoleStatus(res: { roleId: any, status: any }) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 删除角色
  @Delete("/system/role/${roleId}", { requestType: 'path' })
  delRole(res: { roleId: any }) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 查询角色已授权用户列表
  @Get("/system/role/authUser/allocatedList", { requestType: 'params' })
  allocatedUserList(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 查询角色未授权用户列表
  @Get("/system/role/authUser/unallocatedList", { requestType: 'params' })
  unallocatedUserList(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 取消用户授权角色
  @Put("/system/role/authUser/cancel", { requestType: 'data' })
  authUserCancel(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 批量取消用户授权角色
  @Put("/system/role/authUser/cancelAll", { requestType: 'data' })
  authUserCancelAll(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 授权用户选择
  @Put("/system/role/authUser/selectAll", { requestType: 'params' })
  authUserSelectAll(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 根据角色ID查询部门树结构
  @Get("/system/role/deptTree/${roleId}", { requestType: 'path' })
  deptTreeSelect(res: { roleId: any }) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }
}
